package cn.com.dhcc.app.pub.module.resmgr.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.com.dhcc.app.core.annotation.WsdColumn;
import cn.com.dhcc.app.core.annotation.WsdNotDbColumn;
import cn.com.dhcc.app.core.annotation.WsdTable;
import cn.com.dhcc.app.core.base.ModuleFeatureBean;
import cn.com.dhcc.app.pub.core.Table.SYS_BASE_TABLE;
/**
 * 菜单
 * @日期：2013-6-6下午7:27:13
 * @作者：乔兵
 * @版权所有：东华软件
 * @版本：1.0
 */
@WsdTable
public class MenuResource extends ModuleFeatureBean implements Comparable<MenuResource>,Serializable {
	private static final long serialVersionUID = 1L;

	public String tableName(){
		return SYS_BASE_TABLE.SYS_BASE_MENU;
	}
	public String schema(){
		return super.schema();
	}
	
	public static enum ResourceType {
		MENU("1","菜单"), //菜单
		RESOURCE("80","非菜单"),//非菜单，例如公共的操作
		ACTION_GROUP("85","操作组"),//操作组
		ACTION("99","操作");//操作
		private String code;
		private String name;
		private ResourceType(String code,String name){
			this.code = code;
			this.name = name;
		}
		public String getCode() {
			return code;
		}
		public String getName() {
			return name;
		}
	}
    public MenuResource(){}
    public MenuResource(String id){this.id = id;}
	@WsdColumn(isId = true)
	private String id;
	private String pid;
	private String shortName;
	private String open;
	private String type;
	private String isPublic;
	private String openNewWindow;
	private Integer ordNum;
	private String actionId;
	private String img;
	private String defaultInit;
	private String hidden;
	private Date modified;
	private String muid;
	private String remark;
	private String fordev;
	@WsdNotDbColumn
	private String outurl;
	@WsdNotDbColumn
	private String url; 
	@WsdNotDbColumn
	private boolean hasAuth;
	@WsdNotDbColumn
	private String extFlag;//扩展属性，可填写任意值
	@WsdNotDbColumn
	private List<MenuResource> childMenuResource = new ArrayList<MenuResource>();
	@WsdNotDbColumn
	private List<LinkResource> childLinkResource = new ArrayList<LinkResource>();
	@WsdNotDbColumn
	private boolean leafMenu;
	@WsdNotDbColumn
	private String navigate;
	
	@WsdNotDbColumn
	private String checked;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	

	public String getShortName() {
		return shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	public String getPid() {
		return pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}

	public String getOpen() {
		return open;
	}

	public void setOpen(String open) {
		this.open = open;
	}

	public String getIsPublic() {
		return isPublic;
	}

	public String getFordev() {
		return fordev;
	}
	public void setFordev(String fordev) {
		this.fordev = fordev;
	}
	public void setIsPublic(String isPublic) {
		this.isPublic = isPublic;
	}

	public String getOpenNewWindow() {
		return openNewWindow;
	}

	public String getExtFlag() {
		return extFlag;
	}

	public void setExtFlag(String extFlag) {
		this.extFlag = extFlag;
	}

	public void setOpenNewWindow(String openNewWindow) {
		this.openNewWindow = openNewWindow;
	}

	public Integer getOrdNum() {
		return ordNum;
	}

	public void setOrdNum(Integer ordNum) {
		this.ordNum = ordNum;
	}

	public Date getModified() {
		return modified;
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}

	public String getMuid() {
		return muid;
	}
	public void setMuid(String muid) {
		this.muid = muid;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public ResourceType getResourceType() {
		return ResourceType.RESOURCE;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getActionId() {
		return actionId;
	}

	public void setActionId(String actionId) {
		this.actionId = actionId;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public boolean isHasAuth() {
		return hasAuth;
	}

	public void setHasAuth(boolean hasAuth) {
		this.hasAuth = hasAuth;
	}

	public boolean isLeafMenu() {
		return leafMenu;
	}

	public void setLeafMenu(boolean leafMenu) {
		this.leafMenu = leafMenu;
	}

	public String getNavigate() {
		return navigate;
	}

	public void setNavigate(String navigate) {
		this.navigate = navigate;
	}

	public String getHidden() {
		return hidden;
	}

	public void setHidden(String hidden) {
		this.hidden = hidden;
	}

	public String getDefaultInit() {
		return defaultInit;
	}

	public void setDefaultInit(String defaultInit) {
		this.defaultInit = defaultInit;
	}

	

	public String getOuturl() {
		return outurl;
	}
	public void setOuturl(String outurl) {
		this.outurl = outurl;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	
	public List<MenuResource> getChildMenuResource() {
		return childMenuResource;
	}
	public void setChildMenuResource(List<MenuResource> childMenuResource) {
		this.childMenuResource = childMenuResource;
	}
	public List<LinkResource> getChildLinkResource() {
		return childLinkResource;
	}
	public void setChildLinkResource(List<LinkResource> childLinkResource) {
		this.childLinkResource = childLinkResource;
	}
	@Override
	public int compareTo(MenuResource o) {
		if(this.type.equalsIgnoreCase(o.getType())){
			return this.ordNum-o.getOrdNum();
		}
		return 0;
	}

	public String getChecked() {
		return checked;
	}
	public void setChecked(String checked) {
		this.checked = checked;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MenuResource other = (MenuResource) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	

}

